//
//  EmoticonCellCollectionViewCell.swift
//  SinaWebo
//
//  Created by mis on 16/3/24.
//  Copyright © 2016年 mis. All rights reserved.
//

import UIKit

class EmoticonCell: UICollectionViewCell {
    
    var emoticon: Emoticon? {
        didSet {
            emoticonBtn.setImage(UIImage(contentsOfFile: emoticon?.imagePath ?? ""), forState: .Normal)
            emoticonBtn.setTitle(emoticon?.emojiStr ?? "", forState: .Normal)
            if let em = emoticon where em.isRemove {
                emoticonBtn.setImage(UIImage(named: "compose_emotion_delete"), forState: .Normal)
            }
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        contentView.addSubview(emoticonBtn)
        
        emoticonBtn.frame = CGRectInset(bounds, 4, 4)
        emoticonBtn.titleLabel?.font = UIFont.systemFontOfSize(32)
        emoticonBtn.backgroundColor = UIColor.whiteColor()
        //设置不能交互
        emoticonBtn.userInteractionEnabled = false
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private lazy var emoticonBtn: UIButton = UIButton()
}
